

<template>

  <div >
       <el-button  class="butB_Sel"  @click="printBtn()">打印</el-button>
	 
	    <span>是否残联:</span>
         <el-checkbox v-model="is_can"></el-checkbox>
     
    <div class="app-container" id="printcons" style="width:600px;height:420px;margin:auto;padding-top:70px;margin-left:30px">
      <div class="" >
   
						     <div class=""   >

  <h3 style="text-align: center;margin: 0 5px;opacity: 0;">{{tabeldata.his_name}}哈哈哈 </h3>
						            						             <h3  style="text-align: center;margin: 0 5px;"> <span v-if="is_can" style="float: right;margin: 0 0.3125rem;font-size: 16px;"> 残联</span></h3>
												<p style="margin: 0 0.3125rem;font-size: 12px;	">
												<span style="float: right;margin: 0 0.3125rem;font-size: 12px;">  </span>
												</p>
												<p  style="margin: 0 0;font-size: 14px;opacity: 0;">发票代码：xxxxxxx</p>
												<p style="margin: 0 0;font-size: 14px;opacity: 0;">发票号码：xxxxxxx
												</p>
                                              
												<h5 style="margin: 0 5px;padding-left:100px"><span style="opacity: 0;"> 医院名称:</span>{{tabeldata.his_name}}</h5>
												<table   cellspacing="0" cellpadding="0" style="width:600px">
												   <tr>
												    <td style=" width:70px; height:23px;" ><span style="opacity: 0;">姓名</span> </td>
												    <td style=" width:70px;height:23px;">{{tabeldata.hospital_info.member.name}}</td>
												    <td style=" width:70px; height:23px;" ><span style="opacity: 0;">性别</span></td>
												    <td style=" width:70px;height:23px;">{{tabeldata.hospital_info.member.gender==1?'男':tabeldata.hospital_info.member.gender==2?'女':''}}</td>
													 <td style=" width:70px; height:23px;" ><span style="opacity: 0;">住院号</span></td>
												    <td style=" width:70px;height:23px;">{{tabeldata.hospital_info.ipt_no}}</td>
												    <td style=" width:70px; height:23px;" ><span style="opacity: 0;">病区</span></td>
												    <td style=" width:70px;height:23px;">{{tabeldata.hospital_info.room_name.split('/')[1]}}</td>
												   </tr>
												   <tr>
												     <td style="height:23px;" > <span style="opacity: 0;">医保卡号</span></td>
												     <td>{{tabeldata.hospital_info.setl_id}}</td>
												     <td style=" height:23px;" > <span style="opacity: 0;">住院时间</span></td>
													 <td colspan="4">{{tabeldata.hospital_info.begntime}}-{{tabeldata.hospital_info.leave_time}} <span style="margin-left:40px">{{tabeldata.hospital_info.day}}</span></td>
													  
												   </tr>
												    <tr>
												     <td style=" height:23px;" ><span style="opacity: 0;">费用项目</span> </td>
												     <td style=" height:23px;" ><span style="opacity: 0;">金额</span></td>
												      <td style=" height:23px;" ><span style="opacity: 0;">费用项目</span> </td>
												     <td style=" height:23px;" ><span style="opacity: 0;">金额</span></td>
													     <td style=" height:23px;" ><span style="opacity: 0;">费用项目</span> </td>
												     <td style=" height:23px;" ><span style="opacity: 0;">金额</span></td>
													     <td style=" height:23px;" ><span style="opacity: 0;">费用项目</span> </td>
												     <td style=" height:23px;" ><span style="opacity: 0;">金额</span></td>
												     </tr>
													   <tr>
												     <td style="height:23px;" ><span style="opacity: 0;">床位费</span></td>
												     <td>{{tabeldata.fee[10].money}}</td>
												     <td style=" height:23px;" ><span style="opacity: 0;">化验费</span></td>
												     <td>{{tabeldata.fee[0].money}}</td>
													 <td style="height:23px;" ><span style="opacity: 0;">西药费</span></td>
												     <td>{{tabeldata.fee[8].money}}</td>
												     <td style="height:23px;" ><span style="opacity: 0;">特殊材料费</span></td>
												     <td>{{tabeldata.fee[4].money}}</td>
												     </tr>
													   <tr>
												     <td style=" height:23px;" >
														 <span style="opacity: 0;">诊查费</span>
														 </td>
												     <td>{{tabeldata.fee[2].money}}</td>
													   <td style=" height:23px;" >
														 <span style="opacity: 0;">治疗费</span>
														 </td>
	
												     <td>{{tabeldata.fee[13].money}}</td>
													   <td style=" height:23px;" >
														 <span style="opacity: 0;">中成药</span>
														 </td>
													 
												     <td>{{tabeldata.fee[12].money}}</td>
													  <td style=" height:23px;" >
														 <span style="opacity: 0;">特殊服务</span>
														 </td>
												    
												     <td>{{tabeldata.amount}}</td>
												     </tr>
													   <tr>
														     <td style=" height:23px;" >
														 <span style="opacity: 0;">护理费</span>
														 </td>
												     
												     <td>{{tabeldata.fee[11].money}}</td>
													 <td style=" height:23px;" >
														 <span style="opacity: 0;">手术费</span>
														 </td>
												  
												     <td>{{tabeldata.fee[3].money}}</td>
													  <td style=" height:23px;" >
														 <span style="opacity: 0;">中草药</span>
														 </td>
													
												     <td>{{tabeldata.fee[9].money}}</td>
													   <td style=" height:23px;" >
														 <span style="opacity: 0;">其他</span>
														 </td>
												
												     <td>{{tabeldata.fee[6].money}}</td>
												     </tr>
													   <tr>
														    <td style=" height:23px;" >
														 <span style="opacity: 0;">检查费</span>
														 </td>
												
												 
												     <td>{{tabeldata.fee[1].money}}</td>
													   <td style=" height:23px;" >
														 <span style="opacity: 0;">电费</span>
														 </td>
												    
												     <td>0</td>
													  <td style=" height:23px;" >
														 <span style="opacity: 0;">调温费</span>
														 </td>
												
												     <td>0</td>
													  <td style=" height:23px;" >
														 <span style="opacity: 0;">合计</span>
														 </td>
												  
												     <td>{{tabeldata.cost}}</td>
												     </tr>
													   <tr>
												     <td colspan="2" style="opacity: 0;height:23px;">总金额（大写）</td>
												    
												     <td colspan="5" style=" height:23px;">
														 {{tabeldata.dx_cost}}
													 </td>
												    
												     </tr>
													   <tr>
														     <td style=" height:23px;" >
														 <span style="opacity: 0;">预交费用</span>
														 </td>
												  
												     <td style=" height:23px;">0</td>
													  <td style=" height:23px;" >
														 <span style="opacity: 0;">现金退款</span>
														 </td>
												  
												     <td></td>
													  <td style=" height:23px;" >
														 <span style="opacity: 0;">支票退费</span>
														 </td>
													
												     <td>0</td>
													 	  <td style=" height:23px;" >
														 <span style="opacity: 0;">应补金额</span>
														 </td>
												  
												     <td></td>
												     </tr>
													   <tr>
												     <td rowspan="2" style="opacity: 0;">备注</td>
												     <td rowspan="2" colspan="7">
													
														 <p > 
													
														 
														 
														 <span style="float:right;margin-right:40px">{{fund_pay_sumamt}}</span>
														 <span style="float:right;margin-right:80px">{{psn_part_amt}}</span>
														   </p>
													 </td>
												    
												     </tr>
												
												</table>
												<p style="opacity: 0;">开票人</p>
												
												<p style="margin: 0rem;"><span style="margin-left:100px">{{tabeldata.create_by}}</span></p>

						               
						     						</div>
		        </div>
                 </div>
  </div>
</template>
<script>

import { getPrintInvoice,getdictIndex } from "@/api/register";

import { printSettlement } from "@/api/zhuyanre";

export default {
	props:['id'],
  data() {
    return {
  tabeldata:{},
  sourcelist:[],
   dayin:false,
   psn_part_amt:0,
fund_pay_sumamt:0,
is_can:false,
    };
  },
  
  mounted(){
	this.getindex()
   this.getpint()
  },
    watch: {
 
    id(n) {
		console.log(this.id)
			 this.getpint()
	}},
  methods: {
	  	  getindex(){
		  	getdictIndex({group_id:'40'}).then(res=>{
				let data = res.data;
				  data.forEach((item, key) => {
				if(item.id==40){
            
             this.sourcelist=item.items;
            } 
			 })
			  })
	  },
	  	  getpint(){
		  	    printSettlement({hospital_id:this.id}).then(res=>{
                            if(res.code==200){
								console.log(res.data)
                               this.tabeldata=res.data
							//     this.tabeldata.zongfee=0
							//    for (let i = 0; i < this.tabeldata.fee.length; i++) {
							// 	   this.tabeldata.zongfee+=parseInt(this.tabeldata.fee[i].money) 
								   
							//    }
							if(this.tabeldata.yb){
									  this.psn_part_amt=this.tabeldata.yb.psn_part_amt,
									this.fund_pay_sumamt=this.tabeldata.yb.fund_pay_sumamt
							}
							
							}
                    })
	  },
	  	    mapxing(num) {
      var art = "";
         this.sourcelist.map(function(value,i,array){
            
            if (value.id == num) {
          art = value.name;
        }
        
       })
	   console.log(art)
        return art;  
    },
        printBtn(e) {
        this.dayin=true
         setTimeout(() => {
      this.dayinfun()
     }, 200);
     
    },
        dayinfun(){
             this.remove_ie_header_and_footer();
      let subOutputRankPrint = document.getElementById("printcons");
      console.log(subOutputRankPrint.innerHTML);
      let newContent = subOutputRankPrint.innerHTML;
      let oldContent = document.body.innerHTML;
      document.body.innerHTML = newContent;
      window.print();
      window.location.reload();
      document.body.innerHTML = oldContent;
      return false;
        },
    //去掉页眉和页脚
    remove_ie_header_and_footer() {
      var hkey_path;
      hkey_path =
        "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
      try {
        var RegWsh = new ActiveXObject("WScript.Shell");
        RegWsh.RegWrite(hkey_path + "header", "");
        RegWsh.RegWrite(hkey_path + "footer", "");
      } catch (e) {}
    },

    
    
  },
   
};
</script>
<style media="print">
				@page {
				  size: auto; /* auto is the initial value */
				  margin: 0mm; /* this affects the margin in the printer settings */
				}
				@media print {
				}
				body {
				  -webkit-print-color-adjust: exact;
				}
					#printcons>>>td{
                        height: 25px!important;
                        /* width: 100px; */
						/* border: 0.5px solid #000000; */
						padding: 0rem;
						margin: 0rem;
						text-align: center;
					}
		
				</style>
<style lang='scss' scoped>
// #printcons>>> tr{
// 						height: 20px!important;
// 						padding: 20px 10px;
// 						margin: 0rem;
						
// 					}
//                     	#printcons>>>td{
//                         height: 20px!important;
//                         // width: 100px;
// 						/* border: 0.5px solid #000000; */
// 						padding: 0rem;
// 						margin: 0rem;
// 						text-align: center;
// 					}
		


</style>